/*
 * Copyright (c) 2025 [ByteDance Ltd. and/or its affiliates.] and/or its affiliates
 * SPDX-License-Identifier: LGPL v2.1+
*/
#ifndef AVCODEC_VE_H2645_PARSE_H
#define AVCODEC_VE_H2645_PARSE_H

#include <inttypes.h>
#include <libavcodec/avcodec.h>

typedef struct VEGetBitContext {
    const uint8_t *buffer, *buffer_end;
} VEGetBitContext;

typedef struct VEH2645NAL {
    int type;
    int ref_idc;
    VEGetBitContext gb;
} VEH2645NAL;

typedef struct VEH2645Packet {
    VEH2645NAL *nals;
    int nb_nals;
} VEH2645Packet;

int ve_h2645_packet_split(VEH2645Packet *pkt, const uint8_t *buf, int length,
                          void *logctx, int is_nalff, int nal_length_size,
                          enum AVCodecID codec_id, int small_padding, int use_ref);

void ve_h2645_packet_uninit(VEH2645Packet *pkt);

int ve_check_h264_interlaceInfo(const uint8_t *extradata, int extradata_size, AVCodecContext* codecContext, int* frame_mbs_only_flag, int * mb_adaptive_frame_field);

#endif  /* AVCODEC_VE_H2645_PARSE_H */